home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1993 November
/
1993-11.d64
/
unbrkable cipher
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
27KB
|
791 lines
100 dv=peek(186):if dv<8 then dv=8
105 poke53280,6:poke53281,6:printchr$(14)chr$(8):b=0
110 gosub840
115 dimx(300),p$(10,10,10)
120 print"[147][212]he main menu is:":print
125 print"[159]1[146] [201]ntroduction (recommended reading)":print
130 print"[159]2[146] [196]emonstration of computer enciphering";:print
135 print"[159]3[146] [196]emonstration of computer deciphering"
140 print"[159]4[146] [208]rinting cipher sheets":print
145 print"[159]5[146] [197]xit to [199]azette [196]isk":print
150 print"[195]hoose [159]1[146] to [159]5[146]."
155 geta$:ifa$<>"1"anda$<>"2"anda$<>"3"anda$<>"4"anda$<>"5"then155
160 ifa$="1"then200
165 ifa$="2"then970
170 ifa$="3"then1895
175 ifa$="4"then2675
180 ifa$="5"thenprint"[147][196]o you wish to quit? (y/n)"
185 geta$:ifa$<>"y"anda$<>"[217]"anda$<>"n"anda$<>"[206]"then185
190 ifa$="y"ora$="[217]"then785
195 ifa$="n"ora$="[206]"then120
200 print"[147][159] [212]he [213]nbreakable [195]ipher"
205 print" by [202]ames [212]. [202]ones ":print
210 print"[201]n cryptography there is a technique":print
215 print"for enciphering plaintext called the":print
220 print"one-time sheet (or ots). [212]he basic":print
225 print"idea underlying the method is to use":print
230 print"random arrays of letters, numbers,":print
235 print"spaces and punctuation marks (if any) by"
240 print"means of which ciphertext is prepared."
245 print"[159][208]ress <space> to continue."
250 geta$:ifa$<>" "then250
255 print"[147][206]o element of the arrays is ever":print
260 print"used more than once. [193] statistical":print
265 print"analysis of the occurrences of elements":print
270 print"or the numbers representing them":print
275 print"will therefore not readily yield":print
280 print"useful information for breaking the":print
285 print"cipher.":print
290 print"[212]he person preparing the cipher-":print
295 print"text and the recipient(s) are":print
300 print"assumed to have duplicate copies":print
305 print"of the cipher arrays."
310 print"[159][208]ress <space> to continue."
315 geta$:ifa$<>" "then315
320 print"[147]":restore:a=0:gosub680
325 print"[204]et us consider a specific example.":print
330 print"[193] set of arrays can consist of up to":print
335 print"ten arrays numbered from 0 to 9. [197]ach":print
340 print"array consists of ten columns (0-9)":print
345 print"and ten rows (0-9)."
350 print"[159][208]ress <space> to continue."
355 geta$:ifa$<>" "then355
360 print"[147]":restore:a=0:gosub680
365 print"[196]ifferent sets of arrays are numbered";:print
370 print"sequentially beginning with 1. [201]n this":print
375 print"example, the set of arrays consists of":print
380 print"a single array, array 0[146].":print
385 print"[159][208]ress <space> to continue."
390 geta$:ifa$<>" "then390
395 print"[147]":restore:a=0:gosub680
400 print"[212]he element of array 0[146] corresponding":print
405 print"to [158]row 0 and [158]column 0 is the number "chr$(34)"2"chr$(34)"."
410 print"[212]he element corresponding to [158]row 8 and":print
415 print"[158]column 5 is "chr$(34)"l"chr$(34)".
420 [153]"open (NULL)ress <space> to continue"
425 [161]a$:[139]a$[179][177]" "[167]425
430 [153]"load":[140]:a[178]0:[141]680
435 [153]"atnn element in a given array is speci-";:[153]
440 [153]"fied by sys(a)(r)(c) where sys(a), sys(r), and":[153]
445 [153]"sys(c) are the array number, row number and";:[153]
450 [153]"column number, respectively. left$ence, sys076";:[153]
455 [153]"would represent "[199](34)"o"[199](34)" in the above array."
460 [153]"open(NULL)ress <space> to continue."
465 [161]a$:[139]a$[179][177]" "[167]465
470 [153]"loadvalnciphered characters are repre-":[153]
475 [153]"sented by three-digit groups, of the ":[153]
480 [153]"form sys(a)(r)(c), written adjacently":[153]
485 [153]"without intervening spaces. ascor example,"
490 [153]"sys012145 would represent two three-digit":[153]
495 [153]"groups of the form":[153]
500 [153]"sys(a1)(r1)(c1)(a2)(r2)(c2)":[153]
505 [153]"with sys(a1)=0,sys (r1)=1,sys (c1)=2, sys(a2)=1,":[153]
510 [153]"sys(r2)=4 and sys(c2)=5."
515 [153]"open(NULL)ress <space> to continue."
520 [161]a$:[139]a$[179][177]" "[167]520
525 [153]"load":[140]:a[178]0:[141]680
530 [153]"right$n the above array, the six-digit":[153]
535 [153]"group, sys013029, represents the word "[199](34)"it"[199](34)"."
540 [153]"(NULL)he element corresponding tosys row 1,":[153]
545 [153]"syscolumn 3 is "[199](34)"i"[199](34)". sys(NULL)ow 2 and syscolumn 9":[153]
550 [153]"specify the element "[199](34)"t"[199](34)"."
555 [153]"open(NULL)ress <space> to continue."
560 [161]a$:[139]a$[179][177]" "[167]560
565 [153]"load(NULL)o element of a given array should"
570 [153]"ever be used more than once, because"
575 [153]"repetition of its row and column could"
580 [153]"conceivably assist in breaking the"
585 [153]"cipher. right$f the same number or letter"
590 [153]"is used multiple times, different"
595 [153]"array numbers, rows and columns are"
600 [153]"found successively for enciphered"
605 [153]"representation. right$n this way, for a"
610 [153]"given array, a particular row and"
615 [153]"column are used once and only once."
620 [153]"(NULL)hen using printed arrays, always"
625 [153]"cross off each element as it is used."
630 [153]"(NULL)his program requires that plain-"
635 [153]"text be entered using only lower case"
640 [153]"letters of the valnglish alphabet and"
645 [153]"the numbers 0 to 9. (NULL)o spaces are"
650 [153]"allowed. (NULL)ubroutines have been intro-"
655 [153]"duced to accomplish this purpose."
660 [151]214,21:[153]
665 [153]"open(NULL)ress <space> to return to main menu"
670 [161]a$:[139]a$[179][177]" "[167]670
675 [137]120
680 [153]"loadopenset of arrays #" 1:[153]
685 [153]"openoncolumn--->sys0 1 2 3 4 5 6 7 8 9 "
690 [129]r[178]0[164]9:[129]c[178]0[164]9
695 [135] p$(a,r,c)
700 [130]c,r
705 [129] r[178]0 [164] 9
710 [153]"sys"[166]09)r;:[129] c[178]0[164]9
715 [153]" "p$(a,r,c);:[130]c:[153]
720 [130] r
725 [153]"ononononononarray" 0"wait"
730 [131] 2,e,s,p,r,g,m,z,z,t
735 [131] u,a,z,i,y,v,p,w,a,k
740 [131] 9,m,v,a,n,q,s,b,9,t
745 [131] m,g,o,h,5,f,1,z,f,o
750 [131] s,1,b,q,h,8,o,2,9,w
755 [131] 9,s,r,4,u,4,y,5,l,3
760 [131] n,7,r,c,p,a,g,b,6,q
765 [131] p,1,3,y,1,3,o,d,m,s
770 [131] a,5,d,g,n,l,z,5,6,0
775 [131] 4,u,3,d,v,1,x,e,j,g
780 [142]
785 [143] exit to gazette disk for 64 users
790 [153]"loadpeeke sure the chr$azette str$isk is in":[153]
795 [153]"the disk drive and press sys<(NULL)val(NULL)(NULL)(NULL)(NULL)>."
800 [161]a$:[139]a$[179][177][199](13)[167]800
805 [160]15:[159]15,dv,15,"r0:menu=menu":[132]15,e:[160]15:[139]e[179][177]63[167]830
810 [153]"load":[151]214,12:[153]:[153]"(NULL)oading (NULL)enu of chr$azette str$isk for 64":[153]
815 [153]"(NULL)sers....(NULL)lease standby...":[129]t[178]1[164]5000:[130]
820 [151]646,[194](53281):[153]"load"[199](34)"menu"[199](34)","dv",1"
825 [151]631,13:[151]198,1:[128]
830 [153]"(NULL)orry! (NULL)he file "[199](34)"menu"[199](34)" was not found!":[128]
835 [143] format a disk
840 [153]"load(NULL)his program requires a newly":[153]
845 [153]"formatted disk or a disk with at least":[153]
850 [153]"100 blocks free.":[153]
855 [153]"str$o you wish to format a disk? (y/n)":[153]
860 [161]a$:[139]a$[179][177]"y"[175]a$[179][177]"(NULL)"[175]a$[179][177]"n"[175]a$[179][177]"(NULL)"[167]860
865 [139]a$[178]"n"[176]a$[178]"(NULL)"[167]115
870 [153]"load(NULL)emove the chr$azette str$isk from the":[153]
875 [153]"the disk drive and insert the disk":[153]
880 [153]"to be formatted.":[153]
885 [141]3420:[141]3355
890 [153]"syslenaution: the disk will be erased.":[153]
895 [153]"peeke sure the disk drive is powered and":[153]
900 [153]"properly connected. (NULL)lease press":[153]
905 [153]"(NULL)val(NULL)(NULL)(NULL)(NULL)waitsys to proceed with formatting":[153]
910 [153]"when the disk drive is ready."
915 [161]a$:[139]a$[179][177][199](13)[167]915
920 [153]"(NULL)ame of disk:wait":[15